#include "home.h"
#include "oled.h"

struct ledstate lstate = {0,0,'-',0};
enum HOMESTATE hstate = HOME;
short LedSpeed = 0;
struct motorstate mstate = {MOFF,WOFF};

void ShowHome(void)
{
    OLED_Clear();
    OLED_ShowString8X16(16, 2, "LED");
    OLED_ShowString8X16(80, 2, "MOTOR");
}

void ShowMotor(void)
{
    OLED_Clear();
    OLED_ShowString8X16(16, 2, "Speed");
    OLED_ShowString8X16(80, 2, "Angle");
}

void ShowWay(void)
{
  OLED_Clear();
  OLED_ShowString6X8(12, 2, "A.Stick control");
  OLED_ShowString6X8(12, 4, "B.IMU control");
}

void ShowLed(void)
{
    switch (lstate.L1)
      {
        case 1: OLED_ShowChar8X16(25, 2, 'A');
        break;
        case 2: OLED_ShowChar8X16(25, 2, 'C');
        break;
        default:OLED_ShowChar8X16(25, 2, '0');
        break;
      }
      OLED_ShowNum8X16(50, 2, lstate.L2, 1);
      OLED_ShowChar8X16(75, 2, lstate.L3);
      OLED_ShowNum8X16(100, 2, lstate.L4, 1);

}

uint16_t L2_time(void)
{
    if(lstate.L2 == 1) return 400;
    else if(lstate.L2 == 2) return 200;
    else if(lstate.L2 == 3) return 120;
    else return 0;
}

